﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SWCInvoice.Enums;
using SWCInvoice.Model;

namespace SWCInvoice.Returntyps {

    /// <summary>
    /// Result of the DeletePageIdentifier method
    /// </summary>
    public class DeletePageIdentifierInfo : BaseInfo {

        #region Constanten

        /// Base object resource typ
        private const string RESOURCE_STRING = "DeletePageIdentifier";

        #endregion

        #region Fields

        /// <summary>
        /// The page count
        /// </summary>
        private int _pageCount;

        /// <summary>
        /// The identifier count
        /// </summary>
        private int _identifierCount;

        #endregion

        #region Properties

        /// <summary>
        /// Base object resource typ
        /// </summary>        
        public override string ResourceString {
            get { return RESOURCE_STRING; }
        }

        /// <summary>
        /// The page count
        /// </summary>
        public int PageCount {
            get { return _pageCount; }
            set { _pageCount = value; }
        }

        /// <summary>
        /// The identifier count
        /// </summary>
        public int IdentifierCount {
            get { return _identifierCount; }
            set { _identifierCount = value; }
        }

        #endregion
     
        #region Construcctor

        public DeletePageIdentifierInfo() {
            _pageCount = 0;
            _identifierCount = 0;
        }

        #endregion

        #region Methods

        public override MessageTyp SetMessageTypByObjectContent() {
            if (IdentifierCount < PageCount)
                MessageTyp = MessageTyp.Warning;
            else
                MessageTyp = MessageTyp.Information;

            return MessageTyp;
        }

        public override Message EnrichMessageWithParameters(Message message) {
            if (MessageTyp == MessageTyp.Warning || MessageTyp == MessageTyp.Information)
                message.Description = string.Format(message.Description, PageCount);

            if (MessageTyp == MessageTyp.Error)
                message.Description = string.Format(message.Description, ExceptionList[0].Message);
            

            return message;
        }

        #endregion
    }
}
